package com.muyi.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.muyi.pojo.dto.CommentDTO;
import com.muyi.pojo.entity.User;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
* @author VRMMO
* @description 针对表【user】的数据库操作Mapper
* @createDate 2025-06-15 18:44:06
* @Entity com.muyi.pojo.entity.User
*/

@Mapper
public interface UserMapper extends BaseMapper<User> {
    /**
     * 查询全部用户
     * @return
     */
//    @Select("select * from user")
//    List<User> list();
    List<User> list(@Param("nickname")String nickname, @Param("gender")String gender, @Param("career_direction")String career_direction);

    /**
     * 根据ID删除用户
     * @param user_id
     */
    @Delete("delete from user where user_id = #{user_id}")
    void deleteById(Integer user_id);

    /**
     * 新增用户
     *
     * @param user
     * @return
     */
    int insertAll(User user);


    /**
     * 更新用户
     * @param user
     */

    void update(User user);



    @Select("select * from user where user_id = #{user_id}")
    User getByUserId(Integer user_id);

    @Select("select * from user where nickname = #{nickname} and password = #{password}")
    User getByUsernameAndPassword(User user);

    @Select("select * from user where nickname = #{nickname}")
    User getByUsername(User user);

}




